package com.tungse.redisson.cfg;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

//@Configuration
public class RedissonConfig {

//    @Bean
    public RedissonClient redissonClient() {
        Config config = new Config();

//        //集群配置
//        config.useClusterServers()
//                .addNodeAddress(
//                        "redis://127.0.0.1:7000",
//                        "redis://127.0.0.1:7001",
//                        "redis://127.0.0.1:7002")
//                .setScanInterval(5000)
//                .setPassword("foobared");

        //单机配置
        config.useSingleServer()
                .setAddress("redis://localhost:6379")
                .setPassword("foobared");
        return Redisson.create(config);
    }
}